const HomeHttp = require("../../utils/Home")
Page({
  data: {
    swiperParams: {
      defaultColor: "#fff",
      dots: true,
      activeColor: "#ff2d51",
      autoplay: true,
      circular: true
    },
    start: 0,
    end:9,
    woman:[]
  },
  async onLoad() {
    wx.showLoading({
      title: "数据正在加载中"
    });
    var start = this.data.start;
    var end = this.data.end;
    var res =await HomeHttp.getWoman(start,end);
    // console.log(res.data)
    this.setData({
      woman:res.data
    })
    wx.hideLoading();
  },
  async onReachBottom() {
    wx.showLoading({
      title: "数据正在加载中"
    });
    var start = this.data.start;
    var end = this.data.end;
    start += 10;
    end += 10;
    var woman = this.data.woman;
    var res = await HomeHttp.getWoman(start, end);
    woman.push(...res.data);
    this.setData({
      woman,
      start,
      end
    })
    wx.hideLoading();
  },
  hanldeClick(event) {
    var { aid } = event.currentTarget.dataset;
    wx.navigateTo({
      url: `/pages/goods_detail/index?id=${aid}`
    })
  }
})